<?php
global $Silas;?>

<?php if ($error):?>
<div id="message" class="error fade"><p><strong><?php echo $error?></strong></p></div>
<?php elseif ($message):?>
<div id="message" class="updated fade"><p><strong><?php echo $message?></strong></p></div>
<?php endif;?>

<style>
fieldset.options {
    clear:both;
    border:1px solid #ccc;
}
fieldset.options legend {
    font-family: Georgia,"Times New Roman",Times,serif;
    font-size: 22px;
}

div.album {
    float:left;
    width:200px;
    height:150px;
    margin-right:15px;
}
div.album td {
    font-size:0.9em;
}
div.album-hidden img {
    opacity:0.5;
}
div.album td strong {
	display:block;
	max-height:2.5em;
	overflow:hidden;
}
</style>


<div class="wrap">
<h2 id="write-post"><?php _e('Photo Album Configuration', 'tantan-flickr');?></h2>
<div style="float:left;margin-right:270px">
<p>
<?php _e('This is the configuration screen for the <a href="http://tantannoodles.com/toolkit/photo-album/">Flickr Photo Album plugin for WordPress</a>.', 'tantan-flickr');?>
</p>
<?php if (!is_object($Silas)):?>
<p>
<?php _e('This plugin is provided by <a href="http://www.tantannoodles.com">TanTanNoodles</a> and licensed free of charge for you to use under the GPL license. This plugin is <em>unsupported</em> and comes with no official technical support. However, you can check the following pages for the latest updates to this plugin, along with any unofficial technical support:', 'tantan-flickr');?>

<br>
<br>
<strong><?php _e('Releases:', 'tantan-flickr');?></strong> <a href="http://tantannoodles.com/toolkit/photo-album/">tantannoodles.com/toolkit/photo-album/</a><br>
<strong><?php _e('Support Group:', 'tantan-flickr');?></strong> <a href="http://www.flickr.com/groups/tantannoodles/">flickr.com/groups/tantannoodles</a>
</p>
<p>
<strong><?php _e('RSS Updates:', 'tantan-flickr');?></strong> <?php _e('Subscribe to the <a href="http://feeds.feedburner.com/TanTanToolkit">TanTanToolkit feed</a> and get notified when there\'s an update to this plugin.', 'tantan-flickr');?>
</p>
<?php endif;?>
</div>

<div  style="float:right;width:250px;margin:10px 0 0 -270px;background:#eee;padding:10px;font-size:0.9em;">
	<?php _e('If you find this plugin helpful, please consider donating a few dollars to support this plugin. Thanks!', 'tantan-flickr');?>
	<br /><br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="joetan54@gmail.com" />
<input type="hidden" name="item_name" value="TanTanNoodles Plugin Donation" />
<input type="hidden" name="item_number" value="Flickr Photo Album" />
<input type="hidden" name="page_style" value="Primary" />

<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="return" value="http://tantannoodles.com/donation-thankyou/" />
<input type="hidden" name="cancel_return" value="http://tantannoodles.com/" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="tax" value="0" />
<input type="hidden" name="cn" value="Message / Note" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="bn" value="PP-DonationsBF" />
<div style="float:left;width:150px;padding-top:10px">
<?php _e('Amount:', 'tantan-flickr');?> $<input type="text" name="amount" value="" style="width:50px;" /> USD<br />
</div>
<div style="float:right;width:100px">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
</div>
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" style="clear:both;" />
</form>

</div>



<?php 
if (!$flickr_apikey || !$flickr_sharedsecret) { // no api key
    include(dirname(__FILE__).'/admin-options-apikey.html');
}elseif (!$flickrAuth) { // authenticate
    include(dirname(__FILE__).'/admin-options-auth.html');
} else { // general flickr settings
?>
	<fieldset class="options">
    <legend><?php _e('Customizations', 'tantan-flickr');?></legend>
<form>
    <p>
    	<strong><?php _e('Popup Overlays:', 'tantan-flickr');?></strong> <?php _e('Add Lightbox style popup overlays to displays to your photos.', 'tantan-flickr');?> <a href="http://tantannoodles.com/flickr-demo/"><?php _e('Demo', 'tantan-flickr');?></a> - <a href="http://code.google.com/p/photo-album/wiki/Documentation#Popup_Overlay_Support"><?php _e('Instructions', 'tantan-flickr');?></a>
	</p>
	<p>
		<strong><?php _e('Custom Comments:', 'tantan-flickr');?></strong> <?php _e('Allow visitors to comment on the photos displayed on your blog (without having to register with Flickr).', 'tantan-flickr');?> <a href="http://code.google.com/p/photo-album/wiki/Documentation#Custom_Photo_Comments"><?php _e('Instructions', 'tantan-flickr');?></a>
	</p>
    <p>
    	<strong><?php _e('Look and Feel:', 'tantan-flickr');?></strong> <?php _e('Not all WordPress themes are created equal, and you may need to tweak a couple templates to match the look and feel of our own blog. Look inside the <code>wp-content/plugins/tantan-flickr/templates</code> directory for the template files.', 'tantan-flickr');?> <a href="http://code.google.com/p/photo-album/wiki/Documentation#Look_and_Feel_Customization"><?php _e('Instructions', 'tantan-flickr');?></a>
    </p>
    <?php
    if (function_exists('wp_super_cache_enable')):?>
	<p><strong>SuperCache</strong>: Looks like you have the SuperCache plugin enabled. <a href='http://code.google.com/p/photo-album/wiki/Documentation#Super_Cache_Compatibility'>Please see here for compatibility notes with SuperCache</a></p>
	<?php endif?>
</form>
    </fieldset>
    

<?php include(dirname(__FILE__).'/admin-options-flickrsettings.html'); ?>
    

    
    <fieldset class="options">
    <legend><?php _e('Photo Albums', 'tantan-flickr');?></legend>
    
    <form method="post">
    <input type="hidden" name="action" value="clearcache" />
    <input type="hidden" name="album" value="all" />
    
    <input type="button" value="<?php _e('Organize Albums', 'tantan-flickr');?>" onclick="window.open('http://www.flickr.com/photos/organize/?start_tab=sets', '_blank');return false" />
    <input type="submit" value="<?php _e('Refresh All Albums', 'tantan-flickr');?>" /><br>
    <small><?php _e('Your Flickr albums will be cached locally to help speed things up. Click <strong>refresh</strong> to synchronize and refresh all your albums, or after you\'ve created a new set.', 'tantan-flickr');?></small>
    </form>
    
    <hr />
    <form method="post">
    <input type="hidden" name="action" value="savealbumsettings" />
    <div id="options-albums"><?php _e('Please wait. Now loading your albums...', 'tantan-flickr');?></div>
    <p class="submit" style="clear:both;"><input type="submit" value="<?php _e('save settings &gt;', 'tantan-flickr');?>" /></p>
    </form>
   
    </fieldset>
    
    <fieldset class="options">
    <legend><?php _e('Group Photos', 'tantan-flickr');?></legend>
    <form method="post">
<?php if (TANTAN_FLICKR_DISPLAYGROUPS): ?>
    <input type="hidden" name="action" value="cleargroupcache" />
    <input type="hidden" name="group" value="all" />
    
    <input type="button" value="<?php _e('Organize Groups', 'tantan-flickr');?>" onclick="window.open('http://flickr.com/photos/organize/?start_tab=groups', '_blank');return false;" />
    <input type="submit" value="<?php _e('Refresh All Groups', 'tantan-flickr');?>" /><br>
    <small><?php _e('Your Flickr groups will be cached locally to help speed things up. Click <strong>refresh</strong> to synchronize and refresh all your groups.', 'tantan-flickr');?></small>
    <hr />
    </form>
    
    <form method="post">
    <input type="hidden" name="action" value="savegroupsettings" />

    <div id="options-groups"><?php _e('Please wait. Now loading your groups...', 'tantan-flickr');?></div>
    
    <a href="#" onclick="return hideAllGroups()"><?php _e('toggle group hiding', 'tantan-flickr');?></a>
    <p class="submit" style="clear:both;">
    <input type="submit" value="<?php _e('save settings &gt;', 'tantan-flickr');?>" />
    </p>
    <script>
    function hideAllGroups() {
        var inputs = document.getElementsByTagName('input')
        for (var i=0; i<inputs.length; i++) {
            if (inputs[i].name == 'hideGroup[]') {
                inputs[i].checked = !inputs[i].checked
            }
        }
        return false
    }
    </script>
<?php else:?>
	<?php _e('Support for groups are not enabled. <a href="http://code.google.com/p/photo-album/wiki/GroupsSupport">Please see this page for instructions on how to configure the plugin to display photos from groups.</a>', 'tantan-flickr');?>
<?php endif; ?>
    </form>
    
    </fieldset>
    
    
    <script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script>
    <script>
    function getOptions(what) {
        var ajaxUpdate = new sack();
        ajaxUpdate._tantan_what = what
        ajaxUpdate.requestFile = "../wp-content/plugins/tantan-flickr/flickr/admin-options-load.php"
        ajaxUpdate.method = 'GET';
        ajaxUpdate.onLoading = function() {}
        ajaxUpdate.onLoaded = function() {}
        ajaxUpdate.onInteractive = function() {}
        ajaxUpdate.onCompletion = function() {
            var options = document.getElementById('options-'+this._tantan_what);
            options.innerHTML = this.response
        }
        ajaxUpdate.runAJAX('view='+what);
    }
    getOptions('albums');
    getOptions('groups');
    
    
    </script>
            	    
    <?php
} //flickr auth
?>



</div>